
export function MP (ak) {
  return new Promise(function (resolve, reject) {
    window.init = function () {
      console.log('123:', 123)
      // eslint-disable-next-line no-undef
      resolve(BMap)
    }
    console.log('BMap....')
    const script = document.createElement('script')
    script.type = 'text/javascript'
    script.src = `http://api.map.baidu.com/api?v=2.0&ak=${ak}&callback=init`
    script.onerror = reject
    document.head.appendChild(script)
  })
}
export function MapV (ak = '123') {
  return new Promise(function (resolve, reject) {
    window.init = function () {
      console.log('???:', 234)
      // eslint-disable-next-line no-undef
      resolve(BMap)
      // resolve(mapv)
    }
    // const mapss = require('./mapv.js')
    // var script = document.createElement('script')
    // script.type = 'text/javascript'
    // script.src = './mapv.js'
    // script.onerror = reject
    // document.head.appendChild(script)
    // console.log('document.head:', document)
    const script = document.createElement('script')
    script.type = 'text/javascript'
    script.src = `http://api.map.baidu.com/api?v=2.0&ak=${ak}&callback=init`
    script.onerror = reject
    document.head.appendChild(script)
  })
}
